package uqbar.comm;

import java.util.List;

import uqbar.comm.protocol.InputFactory;
import uqbar.comm.protocol.InputProcessor;
import uqbar.comm.protocol.Protocol;


public class CallerProtocol<Input> extends ProtocolDecorator<Input> {

	private Caller<Input> caller;

	public CallerProtocol(final Protocol<Input> decorated, final Caller<Input> caller) {
		super(decorated);
		this.caller = caller;
	}

	@Override
	public InputFactory<Input> newInputFactory() {
		return new CallerInput<Input>(super.newInputFactory(), this.caller, this.getDecorated().newInputBuilder());
	}

	@Override
	public List<InputProcessor<Input>> newInputProcessors() {
		List<InputProcessor<Input>> list = super.newInputProcessors();
		list.add(new InputLogger<Input>());
		return list;
	}

}
